package com.onesports.intelligent.k12.polarlight.controller.wx.product;

import cn.oneframework.common.domain.dto.IdDTO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.onesports.framework.kit.common.valid.Json;
import com.onesports.intelligent.k12.polarlight.common.utils.ResultUtil;
import com.onesports.intelligent.k12.polarlight.constant.ApiPathConstants;
import com.onesports.intelligent.k12.polarlight.domain.dto.market.ProductInsertDTO;
import com.onesports.intelligent.k12.polarlight.domain.dto.market.ProductIsSellDTO;
import com.onesports.intelligent.k12.polarlight.domain.dto.market.ProductSelectDTO;
import com.onesports.intelligent.k12.polarlight.domain.vo.course.GetCampusIntroduceVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.course.GetCourseVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.product.ProductSelectByIdVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.product.ProductSelectPageVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.product.WxEvaluateVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.product.WxProductVO;
import com.onesports.intelligent.k12.polarlight.service.sys.ProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author chenrl
 **/
@Api(tags = "小程序-商品展示")
@RestController
@RequiredArgsConstructor
@RequestMapping(ApiPathConstants.WX_PRODUCT)
@PreAuthorize("hasAuthority('MINI_APP')")
public class WXProductController {
    private final ProductService productService;

    @ApiOperation("查询课程")
    @GetMapping("/get-course")
    public ResponseEntity<List<WxProductVO>> getProduct() {
        return ResultUtil.success(productService.getProduct());
    }

    @ApiOperation("课程详情")
    @GetMapping("/get-details")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "productId", value = "商品编号", required = true, dataType = "String", paramType = "query"),
    })

    public ResponseEntity<String> getDetails(String productId) {
        return ResultUtil.success("",productService.getDetails(productId));
    }
    @ApiOperation("商品评价")
    @GetMapping("/get-evaluate")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "productId", value = "商品编号", required = true, dataType = "String", paramType = "query"),
    })
    public ResponseEntity<List<WxEvaluateVO>> getEvaluate(String productId) {
        return ResultUtil.success(productService.getEvaluate(productId));
    }
}













